#include "pcmaacdecode.h"
#include "ffmepgutils.h"

PCMAACDecode::PCMAACDecode(QObject *parent) : QThread(parent)
{
    connect(this,&QThread::finished,this,&QThread::deleteLater);
}

PCMAACDecode::~PCMAACDecode()
{

    disconnect();

    requestInterruption();

    quit();

    wait();

    qDebug() << "PCMAACDecode destroy";
}

void PCMAACDecode::run()
{

    PCMSpec pcmSpec;

    pcmSpec.inFilePath = "/Users/tgy/Documents/ffmpeg/audio/recode_pcm_48000_2_16_again.aac";
    pcmSpec.outFilePath = "/Users/tgy/Documents/ffmpeg/audio/recode_pcm_48000_2_16_decode.pcm";

    FFMEPGUtils::pcmAACDecode(pcmSpec);

    qDebug() << pcmSpec.sampleRate;
    qDebug() << av_get_channel_layout_nb_channels(pcmSpec.channelLayout);
    qDebug() << av_get_sample_fmt_name(pcmSpec.sampleFormat);

}


